package com.wyh.mapper;

import com.wyh.entity.Announcements;
import com.wyh.utils.sqlUtils.announcement.addAnnouncementSqlDynamic;
import com.wyh.utils.sqlUtils.announcement.updateAnnouncementSqlDynamic;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AnnouncementsMapper {
    //查找公告
    @Select("SELECT * FROM announcements where id = #{id}")
    List<Announcements> selectAnnouncementsById(@Param("id") Integer id);
    //发布公告
    @InsertProvider(type = addAnnouncementSqlDynamic.class , method = "addDynamic")
    void addAnnouncements(Announcements announcements);
    //获取所有公告
    @Select("SELECT * FROM announcements")
    List<Announcements> getAll();
    //寻找公告工具
    @Select("SELECT * FROM announcements where id = #{id}")
    Announcements findExist(@Param("id") long id);
    //修改公告
    @UpdateProvider(type = updateAnnouncementSqlDynamic.class , method = "updateDynamic")
    void updateAnnouncements(Announcements announcements);
    //删除公告
    @Delete("DELETE FROM announcements WHERE id = #{id}")
    void deleteAnnouncements(@Param("id") long id);
}
